import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    name:'main',//主入口页面
    component: () => import('@/views/Main'),
    redirect:'/main'
  },
  {
    path:'/login',
    name:'login',
    component: () => import('@/views/Login') //登录注册页
  },
  {
    path:'/main',
    name:'/main',
    component: () => import('@/views/Main'),//前台
    redirect:'/main/index',
    children:[
      {
        path:'/main/index',
        name:'mainson',
        component: () => import('@/views/Main/indexSon/mainSon')//主页
      },
      {
        path:'/case',
        name:'case',
        component: () => import('@/views/Main/Case')//病例展示
      },
      {
        path:'/caselist',
        name:'caselist',
        component: () => import('@/views/Main/Caselist')//病例列表
      },
      {
        path:'/specialist',
        name:'specialist',
        component: () => import('@/views/Main/Specialist')//专家列表
      }
    ]
  },
  {
    path:'/appointment',
    name:'appointment',
    component: () => import('@/views/Appointment/appointment'), //预约页
    redirect:'/appointment/index',//重定向到预约主页
    children:[
      {
        path:'/appointment/index',
        name:'index',
        component: () => import('@/views/Appointment/index')//预约主页
      }
    ]
  },
  {
    path:'/admin',
    name:'admin',
    component: () => import('@/views/Admin') //后台管理页面
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
